<template>
  <view class="u-p-l-26 u-p-r-26 u-p-t-26 u-flex u-flex-wrap flex-between">
    <view class="item-link u-m-b-26" v-for="(item, index) in homeList" :key="index" @click="itemJump(item)">
      <image :src="item.cover" class="item-link-img"></image>
    </view>
<!--    <navigator url="/pages/report/index" class="item-link u-m-b-26" title="职业百科">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/explore/zhuanye" class="item-link u-m-b-26" title="专业百科">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/explore/school" class="item-link u-m-b-26" title="院校一览">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/explore/job" class="item-link u-m-b-26" title="我的规划">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/explore/xuanke" class="item-link u-m-b-26" title="选科要求">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/explore/fill_in" class="item-link u-m-b-26" title="模拟填报">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/explore/school?type=1" class="item-link u-m-b-26" title="分数线">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>
    <navigator url="/pages/batch/index" class="item-link u-m-b-26" title="批次线">
      <image src="../../static/img/user_bg.png" class="item-link-img"></image>
    </navigator>-->
  </view>
</template>

<script>
import {request} from "../../util/api";

export default {
  mounted() {
    request({
      url: '/system/wx/CompassAppExplore/list',
      token: true,
      platfom: 'weixin'
    }).then(res => {
		console.log(res)
      this.homeList = res
    })
  },

  data() {
    return {
      homeList: []
    }
  },

  methods: {
    itemJump(item) {
      if (item.url) {
        const url = item.url.includes('switchTab:') ? item.url.split('switchTab:')[1] : item.url
        this.$u.route({
          url: url,
          type: item.url.includes('switchTab:') ? 'switchTab' : 'navigateTo',
          params: {
            homeListTouchId: item.id
          }
        })
      }
    }
  },

  onShareAppMessage(res) {}
}
</script>

<style scoped lang="scss">
.item-link {
  width: 338upx;
  height: 338upx;
  .item-link-img {
    width: 100%;
    height: 100%;
  }
}
</style>
